//
//  NoState.m
//  INFSWA02
//
//  Created by Chris Kievit on 10-10-11.
//  Copyright 2011 Pro4all. All rights reserved.
//

#import "MainViewController.h"
#import "NoState.h"
#import "Board.h"
#import "Square.h"
#import "Piece.h"
#import "ActionState.h"

@class EnemyPieceSelectedState;

@implementation NoState

- (id)init
{
    if (self = [super init]) 
    {
        // Initialization code here.
    }
    
    return self;
}

- (void)didSelectSquare:(Square *)square onBoard:(Board *)board
{
    if([square hasPiece]) 
    {
        Piece *piece = [square piece];
        
        if ([piece belongsToPlayer:board.currentPlayer])
        {
            [[square button] setTextColor:[NSColor blueColor]];
            [(ActionState *)[board actionState] setSelectedPiece:piece];
            [board setCurrentState:[board actionState]];
            
            [board.mainViewController setColor:[NSColor greenColor] forSquares:[square squaresWhichCanBeMovedAt]];
            [board.mainViewController setColor:[NSColor greenColor] forSquares:[square squaresWhichCanBeAttacked]];
        } 
        else 
        {
            NSLog(@"%@", [piece description]);
        }
    }
}

@end
